package net.zjitc.servlet.product;

import net.zjitc.domain.Product;
import net.zjitc.service.product.ProductService;
import net.zjitc.service.product.productServiceImpl.ProductServiceImpl;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.log4j.Logger;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2017/10/19.
 */
@WebServlet(name = "ProductListServlet",urlPatterns = "/productListServlet")
public class ProductListServlet extends HttpServlet {

    private Logger logger = Logger.getLogger("ProductListServlet");

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        logger.debug("debug start...");/*优先级*/
        logger.info("info start...");
        logger.warn("warn start...");
        logger.error("error start...");
        logger.fatal("error start...");

        Product product = new Product();
        Map map = request.getParameterMap();


        ProductService service = new ProductServiceImpl();
        List<Product> list = service.findAll();
        request.setAttribute("productlist",list);
        request.getRequestDispatcher("/cart/productlist.jsp").forward(request,response);

    }
}
